/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package downloadmanager.downloader;

/**
 *
 * @author Administrator
 */
public class SegmentBean {

    private int index;
    private long initialStartPositon;
    private long startPositon;
    private long endPosition;

    public SegmentBean() {
    }

    public SegmentBean(DownloadSegment segment) {
        index = segment.getIndex();
        initialStartPositon = segment.getInitialStartPosition();
        startPositon = segment.getStartPosition();
        endPosition = segment.getEndPosition();
    }

    public DownloadSegment toDownloaderSegment() {
        DownloadSegment ds = new DownloadSegment();
        ds.setIndex(index);
        ds.setInitialStartPosition(initialStartPositon);
        ds.setStartPosition(startPositon);
        ds.setEndPosition(endPosition);
        return ds;
    }

    /**
     * @return the index
     */
    public int getIndex() {
        return index;
    }

    /**
     * @param index the index to set
     */
    public void setIndex(int index) {
        this.index = index;
    }

    /**
     * @return the initialStartPositon
     */
    public long getInitialStartPositon() {
        return initialStartPositon;
    }

    /**
     * @param initialStartPositon the initialStartPositon to set
     */
    public void setInitialStartPositon(long initialStartPositon) {
        this.initialStartPositon = initialStartPositon;
    }

    /**
     * @return the startPositon
     */
    public long getStartPositon() {
        return startPositon;
    }

    /**
     * @param startPositon the startPositon to set
     */
    public void setStartPositon(long startPositon) {
        this.startPositon = startPositon;
    }

    /**
     * @return the endPosition
     */
    public long getEndPosition() {
        return endPosition;
    }

    /**
     * @param endPosition the endPosition to set
     */
    public void setEndPosition(long endPosition) {
        this.endPosition = endPosition;
    }
}
